home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple Developer Connection Student Program
/
ADC Tools Sampler CD Disk 3 1999.iso
/
Cool Demos, SDKs, & Tools
/
Demos⁄Tools⁄Offers
/
Eiffel for CW beta 3
/
EiffelS2
/
LIBRARY
/
MOTEL
/
Windows.c
< prev
Wrap
Text File
|
1999-05-28
|
4KB
|
139 lines
/*------------------------------------------------------------------*/
/* Eiffel/S II MacOS Runtime */
/*------------------------------------------------------------------*/
/* Author : Ian Joyner */
/* Release : 1.0 */
/* Date : Dec. 1997 */
/* Copyright : Ian Joyner */
/*------------------------------------------------------------------*/
/********************************************************************/
/* */
/* WINDOWs */
/* */
/********************************************************************/
#include <Windows.h>
#include <Controls.h>
#include <ToolUtils.h>
#include <Eiffel2.h>
#include "MOTEL.h"
INTEGER platform_window_port_size ()
{
CWindowRecord p;
return (sizeof (p));
}
WindowPtr platform_new_window (void *wStorage, INTEGER left, INTEGER top, INTEGER right, INTEGER bottom,
ConstStr255Param title, Boolean visible,
INTEGER procID, WindowPtr behind,
Boolean goAwayFlag, INTEGER refCon)
{
Rect bounds_rect;
Str255 scratch;
SetRect (&bounds_rect, left, top, right, bottom);
strcpy (scratch, title);
c2pstr ((char *)scratch); /* This might not be right if string is loaded from a resource */
return NewCWindow (wStorage, &bounds_rect, scratch, visible, procID, behind,
goAwayFlag, refCon);
}
WindowPtr platform_get_new_window (INTEGER windowID, void *wStorage, WindowPtr behind)
{
return GetNewCWindow (windowID, wStorage, behind);
}
POINTER platform_window_get_title (WindowPtr w)
{
GetWTitle (w, &scratch_string);
p2cstr ((char *)scratch_string);
return &scratch_string;
}
void platform_window_set_title (WindowPtr w, ConstStr255Param title)
{
Str255 scratch;
strcpy (scratch, title);
c2pstr ((char *)scratch); /* This might not be right if string is loaded from a resource */
SetWTitle (w, scratch);
}
void platform_set_ref_con (WindowPtr w, INTEGER eiffel_object)
{
SetWRefCon (w, eiffel_object);
}
void platform_window_drag (WindowPtr w, INTEGER x, INTEGER y, INTEGER left, INTEGER top, INTEGER right, INTEGER bottom)
{
Rect bounds_rect;
Point p;
SetPt (&p, x, y);
SetRect (&bounds_rect, left, top, right, bottom);
DragWindow (w, p, &bounds_rect);
}
void platform_window_grow (WindowPtr w, INTEGER x, INTEGER y)
{
long grow_size;
Rect limit_rect;
Point p;
int kMinDocSize = 64;
int kMaxDocSize = 32767;
SetPt (&p, x, y);
SetRect (&limit_rect, kMinDocSize, kMinDocSize, kMaxDocSize, kMaxDocSize);
grow_size = GrowWindow (w, p, &limit_rect);
if (grow_size != 0)
{
SizeWindow (w, LoWord (grow_size), HiWord (grow_size), true);
}
}
BOOLEAN platform_window_track_go_away (WindowPtr w, INTEGER x, INTEGER y)
{
Point p;
SetPt (&p, x, y);
return TrackGoAway (w, p);
}
BOOLEAN platform_window_track_box (WindowPtr w, INTEGER mouse_loc, INTEGER x, INTEGER y)
{
Point p;
SetPt (&p, x, y);
return TrackBox (w, p, mouse_loc);
}
void platform_window_zoom (WindowPtr w, INTEGER mouse_loc, BOOLEAN front)
{
ZoomWindow (w, mouse_loc, front);
}
INTEGER platform_find_control (WindowPtr w, INTEGER x, INTEGER y, INTEGER *control)
{
INTEGER part;
ControlHandle which_control;
Point p;
SetPt (&p, x, y);
part = FindControl (p, w, &which_control);
if (part != 0)
*control = GetControlReference (which_control);
return part;
}